package main

import "fmt"

func success() {
	defer func() {
		fmt.Println(recover())
	}()
}

func failure() {
	defer func() {
		fmt.Println(recover())
	}()
	fmt.Println("failure")
	panic("error!")
}

func failure2() {
	defer func() {
		fmt.Println("catch latest err")
		fmt.Println(recover())
	}()

	defer func() {
		fmt.Println("failure 02")
		panic("error 02")
	}()

	fmt.Println("failure")
	panic("error")
}

func main() {
	// success()
	// failure()
	failure2()
}
